<script setup lang="ts">
// 获得下拉数据
import {inject, ref} from "vue";
import {Node} from "@antv/x6";
import './node-style.scss'

const formData = reactive<any>({
})
const id=ref<string>()
const getNode=inject<()=>Node>('getNode')
if(getNode){
  const node=getNode()
  id.value=node.id
  node.setData(formData)
}
onBeforeMount(()=>{
  if(getNode){
    const node=getNode()
    const d=node.getData()
    if (d){
      Object.assign(formData,d)
    }else {
      node.setData(formData)
    }
  }
})
onMounted(() => {
})
watch(formData,()=>{
  if(getNode){
    const node=getNode()
    node.setData(formData)
  }
},{deep:true,immediate:false})
</script>

<template>
  <div class="node">
    <div class="node-title">
      <div>输入</div>
      <div class="flow-dot flow-right" magnet="true" :class="'flow-exec'" x-type="output-exec" :x-id="'output-exec_'+id"></div>
    </div>
  </div>
</template>

<style scoped lang="scss">

</style>
